package
{
	import flash.display.MovieClip;
	import flash.geom.Point;
	
	import classes.BezierCurve;
	import classes.SimplePolyBezier;

	public class Test extends MovieClip
	{
		
		private var data:Array = [50.5269775390625, 51.9002685546875, 51.7781982421875, 51.4119873046875, 50.2828369140625, 51.4119873046875, 51.2899169921875, 49.9776611328125, 51.5950927734375, 50.4049072265625, 51.7781982421875, 50.6490478515625, 50.8321533203125, 50.9542236328125, 50.8321533203125, 51.5340576171875, 51.2899169921875, 51, 50.9542236328125, 73.4151611328125, 81.914306640625, 0, 34.734130859375, 61.498046875, 62.71875, 0, 71.4010009765625, 53.6092529296875, 50.4659423828125, 50.8321533203125, 50.8931884765625, 51.9613037109375, 50.7711181640625, 50.5880126953125, 50.6490478515625, 50.8931884765625, 50.9542236328125, 50.8931884765625, 50.8321533203125, 0, 102, 37.4654541015625, 48.0245361328125, 51.4119873046875, 23.3052978515625, 28.47802734375, 61.009765625, 56.401611328125, 51.2899169921875, 50.4659423828125, 51.2288818359375, 50.8321533203125, 50.8931884765625, 50.7711181640625, 51, 51, 50.8321533203125, 50.8321533203125, 55.241943359375, 32.292724609375, 102, 102, 42.1956787109375, 0, 36.3057861328125, 7.451416015625, 53.7313232421875, 50.8931884765625, 51.4730224609375, 50.8321533203125, 50.8321533203125, 51.2288818359375, 51.7781982421875, 51.3509521484375, 50.8931884765625, 51.4730224609375, 47.612548828125, 73.5830078125, 102, 13.7685546875, 0, 0, 85.0728759765625, 78.3284912109375, 50.9542236328125, 51.1678466796875, 50.7711181640625, 51.0457763671875, 49.7945556640625]
		
		public function Test()
		{
			
			
			var x:int=0;
			var y:int=0;
			var points:Array = [];
			this.graphics.lineStyle( 2, 0xF78B56 );
			
			
			for( var i:int=0,count:int=data.length; i<count ; i+=1 ){
				this.graphics.lineTo( x, data[i] );
				x += 3;
				points.push( new Point( x, data[i] ) ) ;
			}
			
			var c:SimplePolyBezier = new SimplePolyBezier();
			c.addPoints( points );
			
			var ii:Number = 0.01;
			var point:Point;
			this.graphics.lineStyle( 2, 0x122fa2 );
			while( ii <= 1 ){
				//point = c.getPosition( ii );
				point = BezierCurve.getPoint( ii, points );
				this.graphics.lineTo( point.x, point.y+100 );
				//trace( point.x +"---------"+ point.y )
				ii+=0.01;
			}
		}
	}
}